package com.example.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.example.domain.Dish;
import com.example.dto.DishCategoryDto;
import com.example.dto.DishDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 *  菜品
 */
@Mapper
public interface DishMapper extends BaseMapper<Dish> {
    @Select("SELECT dish.id AS id,dish.name AS NAME,dish.category_id AS categoryId,dish.price AS price,\n" +
            "dish.code AS CODE,dish.image AS image,dish.description AS description,dish.status AS STATUS,dish.sort AS sort,\n" +
            "dish.create_time AS createTime,dish.update_time AS updateTime,dish.create_user AS createUser,dish.update_user AS updateUser,\n" +
            "category.name AS categoryName\n" +
            "FROM dish,category WHERE dish.category_id=category.id and dish.name like #{name} order by dish.update_time desc ")  //
    IPage<DishCategoryDto> getPage(IPage<DishCategoryDto> iPage, String name);


}
